@include('admin.header')
<style type="text/css">
.pic-list li {
	margin-bottom: 5px;
}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		
		<form method="post" class="form-horizontal js-category-add">
			<div class="row-fluid">
				<table class="table table-bordered">
					<tr>
						<th>旧密码</th>
						<td>
							<input type="password" style="width:400px;" name="old_pwd"  value="" placeholder="请输入旧密码"/>
						</td>
					</tr>
					<tr>
						<th>新密码</th>
						<td>
							<input type="password" style="width:400px;" name="new_pwd"  value="" placeholder="请输入新密码"/>
						</td>
					</tr>				
					<tr>
						<th>确认新密码</th>
						<td>
							<input type="password" style="width:400px;" name="rnew_pwd"  value="" placeholder="请输入确认密码"/>
						</td>
					</tr>						
					
				</table>
			</div>
			<div class="form-actions">
				<input type="hidden" name="_token"  value="{{csrf_token()}}"/>
				<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="/static/js/common.js"></script>
	<script type="text/javascript" src="/static/js/validate/validate.js"></script>
	<script type="text/javascript" src="/static/js/layer/layer.js"></script>
	<script type="text/javascript" src="/static/js/ajaxfileupload.js"></script>
	<script type="text/javascript">
		$(function() {
			$(".js-category-add").validate({
				rules: {
					old_pwd: {
						required: true
					},
					new_pwd: {
						required: true
					},
					rnew_pwd: {
						required: true
					}
	
				},
				messages: {
					old_pwd: {
						required: "请输入旧密码"
					},
					new_pwd: {
						required: "请输入新密码"
					},
					rnew_pwd: {
						required: "请输入确认密码"
					},
				},
				submitHandler: function () {
					$.post("/user/modify_pwd",$('.js-category-add').serialize(), function (msg) {
						if (msg.status == 1) {
							layer.confirm(msg.info, {
								btn: ['确定']
							}, function(){
								window.location.href="{{asset('user/login')}}";
							});
						} else {
							showMsg(msg.info);
						}
					}, 'json');
					return false;
				}
			});
		});
		/**
		 * layer提示
		 */
		function showMsg(msg){
			layer.alert(msg, {
				title: '提示',
				icon: 2,
			});
		}

	</script>
</body>
</html>